<template>
  <div align="right">
    设备名起始:<vxe-input v-model="设备名起始" placeholder="设备名起始" type="integer"></vxe-input><br />
    设备名结束<vxe-input v-model="设备名结束" placeholder="设备名结束" type="integer"></vxe-input><br />
    <vxe-button status="primary" content="确定" @click="提交" :loading="加载中"></vxe-button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      设备名起始: 1,
      设备名结束: 10,
      加载中: false,
    };
  },
  methods: {
    提交() {
      const T=this
      if (!this.设备名起始 || !this.设备名结束  ) {
        this.$XModal.alert({content: "输入错误.请检查", status: "error"});
        return;
      }
      if (this.设备名起始 > this.设备名结束) {
        this.$XModal.alert({content: "起始值大于结束值范围错误", status: "error"});
        return;
      }
      this.加载中 = true;
      const 地址 = "/huifu/state";
      const 提交数据 = {
        开始编号: parseInt(this.设备名起始),
        结束编号: parseInt(this.设备名结束),
      };
      const 成功提示 = (response) => {
        this.加载中 = false;
        this.$XModal.message({ content: "批量恢复成功", status: "success" });
        location.reload();
      };
      const 失败提示 = (response) => {
        this.加载中 = false;
        this.$XModal.message({ content: "批量恢复失败", status: "error" });
      };
      this.$请求(地址, 提交数据, 成功提示, 失败提示);
    },
  },
};
</script>

<style>
</style>